package cn.com.surker.material.dao;

import cn.com.surker.material.entity.MainMaterialInventoryDetail;
import cn.com.surker.material.vo.MaterialInventoryDetailVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * <p>
 * 材料盘存表 Mapper 接口
 * </p>
 *
 * @author admin
 * @since 2024-12-05
 */
public interface MainMaterialInventoryDetailDao extends BaseMapper<MainMaterialInventoryDetail> {

    /**
     * 云端分页查询
     * @param page
     * @param dbCode
     * @return
     */
    IPage<MaterialInventoryDetailVo> findCloudPage(@Param("page") Page page, String dbCode, Long orgId, String today,
            Long materialId, Long storageId, Integer storeType, String searchVal, Long lineId, Integer isEnjoy, String startTime, String endTime);

    /**
     * 根据公司仓位信息，查询数据
     * @param dbCode
     * @param orgId
     * @param today
     * @param materialId
     * @param storageId
     * @return
     */
    MainMaterialInventoryDetail findOrgByStorage(String dbCode, Long orgId, String today, Long materialId, Long storageId);

    /**
     * 查询是否审核
     * @param dbCode
     * @param orgId
     * @param today
     * @param isCheck
     * @param isFinance
     * @return
     */
    Integer findCheckTotal(String dbCode, Long orgId, String today, Integer isCheck, Integer isFinance);

    /**
     * 根据ID查询云端或本地数据
     * @param dbCode
     * @param id
     * @return
     */
    MainMaterialInventoryDetail findCloudById(String dbCode, Long id);

    Integer insertCloudSql(String insertSql);

    Integer updateCloudSql(String updateSql);

    /**
     * 批量新增数据
     * @param dbCode
     * @param list
     * @return
     */
    Integer saveCloudBatch(String dbCode, List<MainMaterialInventoryDetail> list);

    /**
     * 查询材料盘存大类
     * @param dbCode
     * @param today
     * @param breedType 查询材料大类统计盘存信息
     * @return
     */
    List<MainMaterialInventoryDetail> findBreedInventory(String dbCode, String today, Integer breedType);

}
